﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Terran
{
	public abstract class ActionProduceTerran : ActionProduce
	{
		public ActionProduceTerran(int buildTime, int minerals, int gas, int food) : base(buildTime, minerals, gas, food) { }
		public override bool IsInvalid(IBuildOrder bo)
		{
			TerranState state = bo.State as TerranState;
			if (bo.State.Minerals < Minerals && bo.State.WorkersOnMinerals == 0) return true;
			if (bo.State.Gas < Gas && bo.State.WorkersOnGas == 0 && state.GasBuilding.Building == 0) return true;
			if (!bo.State.HaveSupply(Food) && (bo.State.SupplyBuilding + bo.State.Supply - (bo.State.Food + Food) <= 0)) return true;
			return false;
		}
	}
}
